package com.example.embed.calcite.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Calcite演示控制器类
 * <p>
 * 提供基本的API接口用于演示Calcite嵌入式SQL查询功能
 * </p>
 *
 * @author zwg
 * @date 2025/2/17 15:22
 */
@Slf4j
@Tag(name = "演示接口", description = "Calcite嵌入式SQL查询演示相关接口")
@RestController
@RequestMapping(path = "/demo")
public class DemoController {

    /**
     * 演示接口首页
     * <p>
     * 返回欢迎信息，用于验证服务是否正常运行
     * </p>
     *
     * @return 欢迎信息字符串
     */
    @Operation(summary = "首页接口", description = "返回Calcite演示服务的欢迎信息")
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "请求成功",
                    content = @Content(schema = @Schema(implementation = String.class))),
            @ApiResponse(responseCode = "500", description = "服务器内部错误")
    })
    @GetMapping("/")
    public String index() {
        log.info("访问Calcite演示服务首页");
        return "Welcome to Calcite Embedded SQL Query Demo Console";
    }
}
